<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>

        //封装为then的对象
//   let tw={
//       then(resolve,reject){
//           resolve("唐玮");
//       }
//   };

//       Promise.resolve(tw).then(v=>{console.log(v);});


          new Promise((resolve,reject)=>{
              resolve("唐");
          }).then(value=>{
              if(value!="唐玮"){
                //   throw new Error("参数错误")
                  return Promise.reject("参数错误");//抛给catch
              }
               console.log(value);
          },null).catch(error=>{
              console.log(error+"fail");
          })
    </script>
</body>
</html>